﻿using System;
using ApiGateway;
using HttpApiGateway;
using HttpApiGateway.Model;
using RpcClient;
using RpcHelper.Validate;
using Wedonek.RpcStore.Gateway.Interface;
using Wedonek.RpcStore.Gateway.Model;
using Wedonek.RpcStore.Service.Model;
namespace Wedonek.RpcStore.Gateway.Controller
{
    /// <summary>
    /// 容器管理
    /// </summary>
    internal class ContainerController : ApiController
    {
        private readonly IContainerService _Service;
        public ContainerController(IContainerService service)
        {
            this._Service = service;
        }
        /// <summary>
        /// 获取容器资料
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ContainerDatum Get([NullValidate("rpc.container.id.null")] Guid id)
        {
            return this._Service.Get(id);
        }
        /// <summary>
        /// 查询容器服务
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PagingResult<ContainerServer> Query(PagingParam<QueryContainerParam> param)
        {
            ContainerServer[] list = this._Service.Query(param.Param, param.ToBasicPaging(), out long count);
            return new PagingResult<ContainerServer>(count, list);
        }
        /// <summary>
        /// 设置容器备注说明
        /// </summary>
        /// <param name="param"></param>
        public void SetRemark(GuidParam<string> param)
        {
            _Service.SetRemark(param.Id, param.Param);
        }
    }
}
